Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 接入蓝鲸监控APM调用链追踪 #1161 #1283

Merged
merged 17 commits into from
Sep 15, 2022

Conversation

jsonwan
Copy link
Collaborator

@jsonwan jsonwan commented Sep 14, 2022

  1. 使用纯SDK实现trace追踪,去除javaagent;
  2. 通过Spring Bean创建线程池,实现子线程trace数据传递;
  3. 自定义Otel SpanExporter配置,支持通过配置项开关trace上报;
  4. 支持配置trace采样比率;
  5. BizCmdbClient部分代码重构。

BizCmdbClient线程池创建使用Spring Bean
QueryAgentStatusClient自动装配设为非强依赖
FlowController自动装配设为非强依赖
FlowController自动装配设为非强依赖
抽取公共common-otel模块,file-worker支持trace上报
private void initSpanAndAddRequestId() {
Span currentSpan = tracer.currentSpan();
if (currentSpan == null) {
currentSpan = tracer.nextSpan().start();
}
spanInScope = tracer.withSpan(currentSpan);
log.debug("currentSpan={}", currentSpan);
log.debug("MDC={}", getMDCContext());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 这里的debug是否有必要
  2. 如果有必要的话,那么要使用isDebugEnabled判断,因为后面的参数getMDCContext()的调用会克隆一个新的HashMap出来,增加资源消耗
    public Map<String, String> getCopyOfContextMap() {
        Map<String, String> hashMap = (Map)this.copyOnThreadLocal.get();
        return hashMap == null ? null : new HashMap(hashMap);
    }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除


@Autowired
public ScriptCheckServiceImpl(DangerousRuleCache dangerousRuleCache) {
public ScriptCheckServiceImpl(DangerousRuleCache dangerousRuleCache, ExecutorService dangerousRuleCheckExecutor) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种ExecutorService类型存在多种的,需要加上@qualifier明确指定会比较好一些。排查下其他地方是否存在类似问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已全部加上

@wangyu096 wangyu096 merged commit 7295760 into TencentBlueKing:master Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants